/**
 * 
 */
package com.dream.house.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.com.servyou.base.exception.DAOException;

import com.dream.house.dao.DocumentDAO;
import com.dream.house.dao.base.HouseBaseDAO;
import com.dream.house.entity.DocumentDTO;

/**
 * @author ahk
 * @since 1.0
 */
public class DocumentDAOImpl extends HouseBaseDAO implements DocumentDAO {

	/* (non-Javadoc)
	 * @see com.dream.house.dao.DocumentDAO#saveDoc(com.dream.house.entity.DocumentDTO)
	 */
	@Override
	public boolean saveDoc(DocumentDTO dto) throws DAOException {
		return createEntity("saveDoc", dto);
	}

	/* (non-Javadoc)
	 * @see com.dream.house.dao.DocumentDAO#updateDoc(com.dream.house.entity.DocumentDTO)
	 */
	@Override
	public boolean updateDoc(DocumentDTO dto) throws DAOException {
		return updateEntity("updateDoc", dto);
	}

	/* (non-Javadoc)
	 * @see com.dream.house.dao.DocumentDAO#removeDoc(java.lang.String)
	 */
	@Override
	public boolean removeDoc(String id) throws DAOException {
		return removeEntity("removeDoc", id);
	}

	/* (non-Javadoc)
	 * @see com.dream.house.dao.DocumentDAO#findsDocs(java.lang.String,String)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<DocumentDTO> findsDocs(String type,String title) throws DAOException {
		Map<String,String> map=new HashMap<String,String>();
		map.put("type", type);
		map.put("title", title);
		
		return (List<DocumentDTO>)getEntitys("findsDocs", map);
	}

	/* (non-Javadoc)
	 * @see cn.com.servyou.base.dao.BaseDAO#getEntityName()
	 */
	@Override
	public String getEntityName() {
		return DocumentDTO.class.getCanonicalName();
	}

	@Override
	public DocumentDTO getDoc(String id) throws DAOException {
		return (DocumentDTO)getEntity("getDoc",id);
	}

}
